<template>
  <div class="avatar-box" v-on="$listeners">
    <img :class="{offline:!online}" :src="src||imgSrc" ondragstart="return false">
  </div>
</template>

<script>
  export default {
    name: 'Avatar',
    data () {
      return {
        imgSrc: require('../assets/headportrait.jpg')
      }
    },
    props: {
      src: {
        type: String,
        default: ''
      },
      online: {
        type: Boolean,
        default: true
      }
    }
  }
</script>

<style scoped lang="scss">
  .avatar-box {
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    display: inline-block;

    img {
      width: 100%;
      height: 100%;
      border-radius: 50%;
      border: 1px solid #ccc;
      background-color: white;
      box-sizing: border-box;

      &.offline {
        filter: grayscale(100%);
      }
    }
  }
</style>
